import Taro, { Component } from '@tarojs/taro'
import Index from './pages/guide/index'
import Envs from './constant/envs'
import './app.scss'

// 如果需要在 h5 环境中开启 React Devtools
// 取消以下注释：
// if (process.env.NODE_ENV !== 'production' && process.env.TARO_ENV === 'h5')  {
//   require('nerv-devtools')
// }
if (process.env.TARO_ENV !== 'alipay') {
  require('@tarojs/async-await')
}
class App extends Component {

  config = {
    pages: [
      'pages/guide/index',
      'pages/auth/index',
      'pages/my/personInfo/index',
      'pages/my/personInfo/edit/index',
      'pages/my/joinClass/index',
      'pages/my/createNewClass/index',
      'pages/my/manageClasses/index',
      'pages/my/manageClasses/editClass/index',
      'pages/my/manageStudents/index',
      'pages/my/feedBack/index',
      'pages/tools/askForBreak/index',
      'pages/tools/askForBreak/breakDetail/index',
      'pages/tools/askForBreak/addNew/index',
      'pages/tools/createHomework/index',
      'pages/tools/createNotice/index',
      'pages/tools/sign/index',
      'pages/tools/sign/signDetail/index',
      'pages/tools/uploadFiles/index'
    ],
    plugins: {
      chooseLocation: {
        version: "1.0.3",
        provider: "wx76a9a06e5b4e693e"
      }
    },
    window: {
      backgroundTextStyle: 'light',
      navigationBarBackgroundColor: '#fff',
      navigationBarTitleText: 'WeChat',
      navigationBarTextStyle: 'black'
    },
    cloud: true,
    permission: {
      "scope.userLocation": {
        "desc": "你的位置信息将用于小程序定位"
      }
    }
  }

  componentDidMount () {
    if (process.env.TARO_ENV === 'weapp') {
      Taro.cloud.init({
        env: Envs.current,
        traceUser: true
      })
    }
  }

  componentDidShow () {}

  componentDidHide () {}

  componentDidCatchError () {}

  // 在 App 类中的 render() 函数没有实际作用
  // 请勿修改此函数
  render () {
    return (
      <Index />
    )
  }
}

Taro.render(<App />, document.getElementById('app'))
